﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLKhachSan.DTO;
using System.Data;
using System.Data.SqlClient;


namespace QLKhachSan.DAO
{
    public class DAO_TaiKhoan
    {
        public static void themTaiKhoan(DTO_TaiKhoan p)
        {
            string[] name = new string[3] { "@TenTK", "@MatKhau", "@Quyen" };
            object[] ob = new object[3] { p.TenTK, p.MatKhau, p.Quyen };
            clsKetNoi.ThucThiLenhCoTS("pr_ThemTK", name, ob, 3);
        }
        public static DataTable hienthiDanhSachTaiKhoan()
        {
            return clsKetNoi.Load("pr_HienThiTK");
        }
        public static void suaTaiKhoan(DTO_TaiKhoan p)
        {
            string[] name = new string[2] { "@MaTK", "@MatKhau" };
            object[] ob = new object[2] { p.MaTK, p.MatKhau};
            clsKetNoi.ThucThiLenhCoTS("pr_SuaTK", name, ob, 2);

        }
        public static void xoaTaiKhoan(DTO_TaiKhoan p)
        {
            string[] name = new string[1] { "@MaTK" };
            object[] ob = new object[1] { p.MaTK };
            clsKetNoi.ThucThiLenhCoTS("pr_XoaTK", name, ob, 1);
        }
    }
}
